<!-- 继承base.html模板 -->
{% extends 'myadmin/base.html' %}
<!-- 模板继承 -->
{% block main_body %}
   <!-- Content Header (Page header) -->
   <section class="content-header">
    <h1>
      菜品类别管理
      <small>订餐系统店铺管理</small>
    </h1>
    <ol class="breadcrumb">
      <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
      <li class="active">菜品分类信息管理</li>
    </ol>
  </section>
  <!-- Main content -->
  <section class="content container-fluid">


      <!-- /.box-header -->
      <div class="box-body table-responsive no-padding">
        <table class="table table-hover">
          <tr>
            <th>id</th>
            <th>店铺名称</th>
            <th>菜品分类</th>
            <th>当前状态</th>
            <th>添加时间</th>
            <th>修改时间</th>
            <th>操作</th>
          </tr>
          {% for vo in categorylist %}
          <tr>
            <td>{{vo.id}}</td>
            <!-- 追加字段 -->
            <td>{{vo.shopname}}</td>
            <td>{{vo.name}}</td>      
            <td>
            {% if vo.status == 1 %}
                <span style="color: lawngreen;">正常</span>
            {% elif vo.status == 2 %}
                <span style="color: hsl(60, 57%, 42%);">禁用</span>
            {% elif vo.status == 9 %}
                <span style="color: rgb(255, 0, 0);">删除</span>
            {% else %}
                <span style="color: rgb(0, 0, 0);">未知状态</span>
            {% endif %}    
            </td>
            <td>{{vo.create_at|date:'Y-m-d'}}</td>
            <td>{{vo.update_at|date:'Y-m-d'}}</td>
            <td>
              <a type="button" href="{% url 'myadmin_category_edit' vo.id %}" class="btn btn-success btn-xs">
                <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> 编辑</a>
              <button type="button" onclick='doDel("{% url 'myadmin_category_delete' vo.id %}")' class="btn btn-danger btn-xs">
                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 删除</button>
              <a href="{% url 'myadmin_product_index' 1 %}?category_id={{vo.id}}" class="btn btn-warning btn-xs">
                <span class="glyphicon glyphicon-search" aria-hidden="true"></span> 查看菜品</a>
            </td>
          </tr>
          {% endfor %}
        </table>
      </div>

      <!-- /.box-body -->
      <div class="box-footer clearfix">
        <a role="button" href="{% url 'myadmin_category_add' %}" class="btn btn-primary">
          <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 添加菜品分类</a>
        <ul class="pagination pagination-sm no-margin pull-right">
          <li><a href="{% url 'myadmin_category_index' ccindex|add:-1 %}?{{mywhere|join:'&'}}">&laquo;</a></li>
          {% for p in plist %}
          <li {% if p == ccindex %}class="active"{% endif %}><a href="{% url 'myadmin_category_index' p %}?{{mywhere|join:'&'}}">{{p}}</a></li>
          {% endfor %}
          <li><a href="{% url 'myadmin_category_index' ccindex|add:1 %}?{{mywhere|join:'&'}}">&raquo;</a></li>
        </ul>
      </div>

  </section>
  <!-- /.content -->
{% endblock %}

